package collectionFramework.assignments;

import java.util.Enumeration;
import java.util.Scanner;
import java.util.Vector;

public class NameProgram {
	public static void main(String args[]) {
		Vector<Name> vv = new Vector<Name>();

		Scanner s = new Scanner(System.in);
		String choice;
		do {
			System.out.println("1. accept first name and surname");
			System.out.println("2. display all the names");
			System.out.println("3. exit");

			int ch = s.nextInt();
			switch (ch) {
			case 1:
				System.out.print("Fist Name: ");
				String first_name = s.next();
				System.out.print("Sur Name: ");
				String sur_name = s.next();
				vv.add(new Name(first_name, sur_name));
				break;
			case 2:
				Enumeration<Name> e = vv.elements();
				while (e.hasMoreElements())
					System.out.println(e.nextElement());
				break;
			case 3:
				break;
			default:
				System.out.println("Invalid option!!");
			}
			System.out.println("Do you want to continue?? (yes/no)");
			choice = s.next();
		} while (choice.equals("yes"));
	}
}
